package com.aspose.cells.a.d.a;

import java.io.IOException;
import java.io.OutputStream;

public class za extends zb {
   private boolean c;
   private za.za d = null;

   public za(OutputStream var1, boolean var2) {
      super(var1, var2);
   }

   public void a(boolean var1) {
      this.c = var1;
      if (this.d == null) {
         this.d = new za.za();
      }

   }

   public void write(int b) throws IOException {
      if (!this.c) {
         super.write(b);
      } else {
         this.d.a((byte)b);
      }

   }

   public void a() throws IOException {
      if (this.d != null) {
         super.write(this.d.b(), 0, this.d.a());
         this.d = new za.za();
      }

   }

   public int b() {
      return this.d != null ? this.d.a() : -1;
   }

   static class za {
      byte[] a = new byte[256];
      int b = 0;

      void a(byte var1) {
         if (this.b + 1 > this.a.length) {
            byte[] var2 = new byte[this.a.length << 1];
            System.arraycopy(this.a, 0, var2, 0, this.b);
            this.a = var2;
         }

         this.a[this.b] = var1;
         ++this.b;
      }

      int a() {
         return this.b;
      }

      byte[] b() {
         return this.a;
      }
   }
}
